import Vue from 'vue'
import { mapGetters } from 'vuex'

// 全局mixin对象
const globalMixin = {
  computed: {
    ...mapGetters(['authWords'])
  },
  methods: {
    /**
     * 判读用户是否有权限
     * @param {String} permCode  权限字
     */
    checkPermCodeExist(permCode) {
      if (this.authWords && this.authWords.length > 0) {
        return this.authWords.includes(permCode)
      } else {
        return false
      }
    }
  }
}

Vue.mixin(globalMixin)
